Skip to content

feat(contrib): add PR review and module scaffold skills#131

Open
jeanscherf wants to merge 4 commits into
mainfrom
feat/sdk-contribution-skills
Open

feat(contrib): add PR review and module scaffold skills#131
jeanscherf wants to merge 4 commits into
mainfrom
feat/sdk-contribution-skills

Conversation

@jeanscherf
Copy link
Copy Markdown
Member

@jeanscherf jeanscherf commented May 20, 2026

Description

Adds two Claude Code skills to `.claude/skills/` for SDK contributors. Skills are invocable via Claude Code CLI (or any compatible agentic tool: Cline, Copilot, etc.) from the repo root.

`/review-pr [PR#]`

Reviews a PR against 23 criteria across 6 sections:

  • A: Process & Compliance — PR template, conventional commits, issue link, AI disclosure
  • B: Security — credentials, internal URLs, sensitive data in code and PR body
  • C: Code Quality — CI checks, version bump, type hints, naming, imports, dependencies, proto freshness
  • D: API & Design — future-proofing, public API hygiene, breaking changes, pagination, telemetry
  • E: Tests & Documentation — test coverage, docstring quality, module structure

Outputs a structured table report with ✅/⚠️/❌/➖ per criterion, blocking issues summary, and optional posting via `gh pr review`.

Line citations are accurate: Phase 2 fetches each changed file at the PR head commit SHA via `gh api`, so all `file:line` references in the report come from `Read` output on the actual files rather than from diff hunk arithmetic.

Accepts a plain PR number (defaults to SAP/cloud-sdk-python), a full GitHub URL, or `owner/repo#number` — so it works for PRs in forks as well as the upstream repo.

`/scaffold-module`

Generates the full standard module layout for a new BTP service integration:

  • 10 files: `init.py`, `client.py`, `config.py`, `exceptions.py`, `_models.py`, `py.typed`, `user-guide.md`, plus test stubs
  • Telemetry wiring: inserts `Module.` into `core/telemetry/module.py` in alphabetical order
  • Self-review phase: runs `uv run ruff check` on generated files and fixes issues before reporting
  • Prints a checklist of remaining manual steps

Type of Change

  • New feature (non-breaking change which adds functionality)

How to Test

  1. From the repo root, run `/review-pr 128` — verify a structured 23-criterion report is produced with accurate `file:line` citations
  2. Run `/review-pr 93` — verify the skill handles a large new-module PR across all 23 criteria
  3. Provide a fork PR URL (e.g. `https://github.com//cloud-sdk-python/pull/1`) — verify the skill fetches files from the fork repo
  4. Run `/scaffold-module` with test inputs (e.g. module=`test_svc`, service=`Test Service`, short=`TS`) — verify 10 files are generated, ruff passes, test passes, then delete the generated files

Checklist

Adds two Claude Code skills to .claude/skills/ for SDK contributors:

- review-pr: reviews a PR against 23 criteria across 6 sections (process,
  security, code quality, API design, tests, documentation). Runs from the
  repo root via gh CLI. Outputs a structured table report with verdict and
  optional gh pr review posting.

- scaffold-module: generates the full standard module layout (10 files +
  telemetry wiring) for a new BTP service integration. Includes a self-review
  phase that runs ruff and fixes issues before reporting.

Both skills are compatible with Claude Code, Cline, Copilot, and other
agentic tools via the tools/compatibility frontmatter fields.
@jeanscherf jeanscherf requested a review from a team as a code owner May 20, 2026 17:18
Replace diff-offset line counting with explicit file fetches. Phase 2
now downloads each changed file to /tmp/pr<number>/<path> at the PR
head ref; Phase 3 reads those files with the Read tool for exact line
numbers instead of deriving positions from unified diff hunk arithmetic.
Comment thread .claude/skills/scaffold-module/SKILL.md Outdated
## Installation

```bash
uv add sap-cloud-sdk --index-url "https://int.repositories.cloud.sap/artifactory/api/pypi/proxy-3rd-party-pypi/simple"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated user-guide.md includes an SAP-internal Artifactory URL. This public repo’s PR template explicitly disallows SAP-internal URLs, could be the new review-pr skill flag this as sensitive data?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 82fca05 — replaced the internal Artifactory URL with plain uv add sap-cloud-sdk.

Comment thread .claude/skills/scaffold-module/SKILL.md Outdated
url=self.url,
client_id=self.clientid,
client_secret=self.clientsecret,
token_url=self.url.rstrip("/") + "/oauth/token",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deriving token_url from url + "/oauth/token" may be wrong for many BTP bindings (service URL vs UAA/auth URL are often separate, e.g. uri + url like in destination).
Consider asking for the binding schema during scaffold input, could be leaving an explicit TODO instead of a concrete default that could mislead new modules?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed in 82fca05 — removed the derived token_url and replaced it with a TODO comment explaining that BTP binding schemas vary and the UAA URL must come from the binding itself, not be guessed from the service URL.

Comment thread .claude/skills/scaffold-module/SKILL.md Outdated
Comment on lines +433 to +436
Run lint to verify the generated files are clean:
```bash
uv run ruff check src/sap_cloud_sdk/<MODULE_NAME>/
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review only runs ruff check on src/. docs/DEVELOPMENT.md recommends the full local gate: ruff check ., ruff format --check ., and ty check ..
Please align the skill so “clean baseline” includes format + type check and I believe that ideally pytest on the generated tests, correct if I`m wrong!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good points, @tiagoek .
Thanks for the review, I'll add your suggestions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 82fca05 — Phase 5 self-review now runs the full gate: ruff check, ruff format --check, ty check, and pytest.

Phase 1 now parses REPO and NUMBER from three input forms: full GitHub
URL, owner/repo#number, or plain number (defaults to SAP/cloud-sdk-python).
All gh commands and the file-fetch API call use the resolved REPO so the
skill works for PRs in forks, not just PRs in the upstream repo.

Also switch file-fetch ref from branch name to head commit SHA to avoid
ambiguity when fork and upstream share the same branch name.
- Remove SAP-internal Artifactory URL from user-guide.md template;
  replace with plain `uv add sap-cloud-sdk`
- Remove incorrect token_url derivation from service URL; BTP binding
  schemas vary and the UAA URL must be read from the binding, not
  guessed from the service URL
- Expand Phase 5 self-review to run the full local gate: ruff check,
  ruff format --check, ty check, and pytest (not just ruff check)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants